
#include "cppLang.h"
#include "baseLang.h"
#include "compileLang.h"
#include <string>

CppLanguage::CppLanguage(   const string& name,
                            const string& compile_option,
                            const string& run_option) : CompileLanguage(name) {
    this->compile_option = compile_option;
    this->run_option = run_option;
    suffix = "cpp";
    disableSysCallSet = { 
        generate_seccomp_ruler(__NR_fork), 
        generate_seccomp_ruler(__NR_vfork), 
        generate_seccomp_ruler(__NR_clone) 
    };
    suffixMap.emplace("cpp", "c++11");
}
std::string CppLanguage::compileFileStr(std::string filename, std::string target) const {
    if (target == "") {
        target = getBinaryFilename(filename);
    }
    string command = "g++ -o " + target + " " + filename + "  -lm -fmax-errors=10 " + compile_option;
    return command;
}

const Language* CPP11_LANG = new CppLanguage{"c++11", " -std=c++11 "};
const Language* CPP14_LANG = new CppLanguage{"c++14", " -std=c++14 "};
const Language* CPP17_LANG = new CppLanguage{"c++17", " -std=c++17 "};
const Language* CPP20_LANG = new CppLanguage{"c++20", " -std=c++20 "};

